execute as @n[tag=smithingTable.forgeButtonInteraction,distance=..5,type=interaction] on target run tag @s add player

#ERRORS
#No Item
execute if entity @n[tag=smithingTable.itemSlot,nbt={item:{components:{"minecraft:custom_data":{smithingTable:{null:true}}}}},type=item_display,distance=..5] run return run function vs:system/game_ctrol/smithing_table/forge/fail/no_item
#Non Forged Items
execute unless data entity @n[tag=smithingTable.itemSlot,type=item_display,distance=..5] item.components."minecraft:custom_data".forge run return run function vs:system/game_ctrol/smithing_table/forge/fail/non_forged_item
#No Money
execute unless function vs:system/game_ctrol/smithing_table/forge/test/voidogen_count run return run function vs:system/game_ctrol/smithing_table/forge/fail/no_money

#SUCCESS
function vs:system/game_ctrol/smithing_table/forge/forge

tag @p[tag=player] remove player
data remove entity @n[tag=smithingTable.forgeButtonInteraction,distance=..5,type=interaction] interaction
